package builders;

import org.joda.time.DateTime;

import users.Person;
import books.Book;
import books.BookInfo;
import books.BookReservation;

/**
 * BookReservation builder.
 */
public class BookReservationBuilder implements IBuilderExampler<BookReservation> {
    private BookInfo book;

    private Person person;

    private DateTime date;

    private DateTime copyReturnedDate;

    private Book reservedCopy;

    private boolean satisfied;

    public BookInfo getBook() {
        return this.book;
    }

    public void setBook(final BookInfo book) {
        this.book = book;
    }

    public Person getPerson() {
        return this.person;
    }

    public void setPerson(final Person person) {
        this.person = person;
    }

    public DateTime getDate() {
        return this.date;
    }

    public void setDate(final DateTime date) {
        this.date = date;
    }

    public DateTime getCopyReturnedDate() {
        return this.copyReturnedDate;
    }

    public void setCopyReturnedDate(final DateTime copyReturnedDate) {
        this.copyReturnedDate = copyReturnedDate;
    }

    public Book getReservedCopy() {
        return this.reservedCopy;
    }

    public void setReservedCopy(final Book reservedCopy) {
        this.reservedCopy = reservedCopy;
    }

    public boolean isSatisfied() {
        return this.satisfied;
    }

    public void setSatisfied(final boolean satisfied) {
        this.satisfied = satisfied;
    }

    @Override
    public BookReservation build() {
        return new BookReservation(this);
    }

    public BookReservationBuilder withBookInfo(final BookInfo aBookInfo) {
        this.book = aBookInfo;
        return this;
    }

    public BookReservationBuilder withPerson(final Person aPerson) {
        this.person = aPerson;
        return this;
    }

    public BookReservationBuilder withReservedCopy(final Book copy) {
        this.reservedCopy = copy;
        return this;
    }

    public BookReservationBuilder withSatisfied(final boolean bool) {
        this.satisfied = bool;
        return this;
    }

    public BookReservationBuilder withDate(final DateTime aDate) {
        this.date = aDate;
        return this;
    }

    public BookReservationBuilder withCopyReturnedDate(final DateTime aDate) {
        this.copyReturnedDate = aDate;
        return this;
    }

    @Override
    public BookReservation example() {
        return new BookReservationBuilder().withBookInfo(new BookInfoBuilder().example())
                .withCopyReturnedDate(DateTime.now()).withSatisfied(true).withDate(DateTime.now())
                .withPerson(new PersonBuilder().example()).withReservedCopy(new BookBuilder().example()).build();
    }

}
